Please note that NOTEX is only tested on Unix and Linux systems (in particular Ubuntu Linux and Mac OS X).

<h3>Get the files</h3>

To install NOTEX you'll need the <b>notex.cgi</b> CGI script or <b>notex.fcgi</b> FastCGI script (the latest version is recommended), the Perl module <b>JavaScript::SpiderMonkey</b> and the <b>SpiderMonkey</b> source code. Here are the latest versions that I have:
<ul>
  <li><a href="http://notex.googlecode.com/files/notex.cgi">notex.cgi</a> - the CGI version of the script</li>
  <li>Alternatively, use <a href="http://notex.googlecode.com/files/notex.fcgi">notex.fcgi</a> - the <a href="http://www.fastcgi.com/">FastCGI</a> version of the script</li>
  <li><a href="http://notex.googlecode.com/files/JavaScript-SpiderMonkey-0.19.tar.gz">JavaScript-SpiderMonkey-0.19.tar.gz</a> - the Perl module <b>JavaScript::SpiderMonkey</b></li>
  <li><a href="http://notex.googlecode.com/files/js-1.7.0.tar.gz">js-1.7.0.tar.gz</a> - the <b>SpiderMonkey</b> source code</li>
</ul>

<h3>How to install</h3>
First, be sure that the perl module <b>Log::Log4perl</b> is installed. For example run <code>cpan install Log::Log4perl</code> as the "root" user. Again, assuming you have "root" access to your machine, you should make sure the files <b>JavaScript-SpiderMonkey-0.19.tar.gz</b> and <b>js-1.7.0.tar.gz</b> are in the <i>same directory</i> then follow these steps on the command line:
<ol>
  <li><code>tar xfz JavaScript-SpiderMonkey-0.19.tar.gz</code></li>
  <li><code>tar xfz js-1.7.0.tar.gz</code></li>
  <li><code>cd js/src</code></li>
  <li><code>make -f Makefile.ref</code></li>
  <li><code>cp *.OBJ/libjs.* /usr/lib</code></li>
  <li><code>cd ../../JavaScript-SpiderMonkey-0.19</code></li>
  <li><code>perl Makefile.PL -E4X</code></li>
  <li><code>make test</code></li>
  <li><code>make install</code></li>
</ol>
You will now have a new <b>libjs</b> library on your flavor of Unix, and a newly installed Perl module called <b>JavaScript::SpiderMonkey</b> with E4X support.

<h3>Running notex.cgi</h3>
The <b>notex.cgi</b> script relies on a number of Perl modules you can install from CPAN, for example by running the command <code>cpan</code> as user "root" or trying <code>perl -MCPAN -eshell</code> instead. Here's a list:
<ul>
  <li><b>Time::HiRes</b> - to measure the precise duration of script runs</li>
  <li><b>Digest::MD5</b> - to generate filenames for cached data files</li>
  <li><b>LWP::UserAgent</b> - to request remote files over the network</li>
  <li><b>CGI</b> - to read query string parameters and remote user details</li>
  <li><b>CGI::Fast</b> - to run the FastCGI version of the NOTEX script</li>
  <li><b>JavaScript::SpiderMonkey</b> - the module you have just installed</li>
</ul>
Finally, you need to configure your Apache web server (or similar) to run CGI scripts. This can be achieved with Apache configuration like this:
<pre>
AddHandler cgi-script .cgi
&lt;Directory "/path/to/your/web/site/"&gt;
    Options ExecCGI
&lt;/Directory&gt;
</pre>
...and make sure that your <b>notex.cgi</b> file is executable with a command
like: <code>chmod a+x notex.cgi</code>

<h3>Running notex.fcgi</h3>
When you need better CGI script performance, FastCGI is a great option. If you're running the FastCGI version of NOTEX, then you'll need to configure your web server. For Apache, use a configuration file like this:
<pre>
AddType application/x-httpd-fcgi .fcgi
FastCgiServer /home/username/web/notex.fcgi -processes 2

&lt;VirtualHost 1.2.3.4:80&gt;
    DocumentRoot /home/username/web
    ServerName www.mydomain.com
    ErrorLog logs/mydomain.com-error_log
    CustomLog logs/mydomain.com-access_log common
&lt;/VirtualHost&gt;
</pre>
As "root", I installed FastCGI on Apache2 with Ubuntu Linux using the commands:
<ol>
  <li><code>apt-get install libapache2-mod-fastcgi</code></li>
  <li><code>apache2ctl restart</code></li>
</ol>
